﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace June11._5Myproject
{
    class Program
    {
        static void Main(string[] args)
        {
            //
            /* ArrayList str = new ArrayList() { "aaa","bbb","ccc","ddd",123,456};
              int index = str.IndexOf("abc");
              if(index != -1)
              {
                  Console.WriteLine("集合中存在abc元素!");
              }
              else
              {
                  Console.WriteLine("集合中不存在abc元素");
              }*/

            //
            /* ArrayList str = new ArrayList() { "aaa", "bbb", "ccc", "ddd", 123, 456 };
             ArrayList newstr = new ArrayList();
             for(int i = 0; i < str.Count; i = i + 2)
             {
                 newstr.Add(str[i]);
             }
             foreach(var a in newstr)
             {
                 Console.WriteLine( a );
             }*/
            //
            /*ArrayList str = new ArrayList() { "aaa", "bbb", "ccc", "ddd", 123, 456 };
            ArrayList insertStr = new ArrayList() { "A", "B", "C" };
            str.InsertRange(1, insertStr);
            foreach(var b in str)
            {
                Console.WriteLine(b );
            }*/
            //使用Sort进行排序
            /*ArrayList str = new ArrayList() { "aaa", "ccc", "bbb", "ddd" };
            str.Sort();
            foreach(var c in str)
            {
                Console.WriteLine(c );
            }*/
            //
            ArrayList str = new ArrayList() { "aaa", "ccc", "bbb", "ddd" };
            str.Reverse();
            foreach(var d in str)
            {
                Console.WriteLine(d );
            }

        }
    }
}
